<?php 
session_start();
include('config.inc.php');
// session variable
$sess_id=$_SESSION['sess_id'];
$sess_user=$_SESSION['sess_user'];
$sess_status=$_SESSION['sess_status'];
if ($sess_id<>session_id() || $sess_user=="" || $sess_status<>"active") {
		header( "Location: login.php");exit();
	}
?>
<form name="profault" action="" method="post">
<table border='1' width='95%' align='center' cellpadding='0'
	cellspacing='0'>
	<tr>
		<td width="477" valign="top"><div style="vertical-align: top;padding:10px 0px 10px 20px;"><small>การแก้ปัญหาเหตุเสีย</small></div>
		<div style="vertical-align: top;padding:5px 0px 5px 40px;"><small><textarea name="solution" id="solution" rows="8" cols="40"></textarea></small></div>
		<div style="vertical-align: top;padding:5px 0px 5px 40px;"><small>ค่าใช้จ่าย <input type="text" name="cost" id="cost"></input></small></div>
		<div style="vertical-align: top;padding:5px 0px 0px 40px;"><small><input name="faultsubmit" type="button" id="faultsubmit" onClick="javascript:doProcessFault();" value="บันทึกการแก้ไข" class="butsubmit">
		</small></div>
		<div id="stPro" align="center"></div>
		</td>
	<td width="450">
	<small>
	<div style="vertical-align: top;padding:10px 0px 0px 40px;">
	  <p>รายละเอียดของผู้ขอ  
	      <?php
	$sql = "select * from users u
left join flag_detail  fl on fl.flag_id = u.flag
where u.username='$sess_user'";
	$result = mysql_query($sql);
	$num = mysql_num_rows($result);
	$arr = mysql_fetch_array($result);	
	?>
	  </p>
	  <div style="vertical-align: top;padding:10px 0px 20px 40px;">
	  <p>ชื่อ <? echo $arr[name ];?></p>
	  <p>อีเมลล์ <? echo $arr[username]."@ttt.co.th";?></p>
	  <p>จังหวัด <? echo $arr[pnthai];?></p>
	  <p>unit_code <? echo $arr[unit_code];?></p>
	  <p>โทรศัพท์ <? echo $arr[tel];?></p>
	  <p>กลุ่มผู้ใช้ <? echo $arr[flag_name];?></p>
	  </div>
	</div>
	</small>
	</td>
	</tr>
</table>
</form>
<? mysql_close($connect); ?>